package com.crt.nexus.core.advice;

import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;

import java.lang.reflect.Method;

@Slf4j
public class AsyncExceptionHandler implements AsyncUncaughtExceptionHandler {

	@Override
	public void handleUncaughtException(Throwable throwable, Method method, Object... objects) {
		log.error("异步方法[{}]执行失败: {} ", method.getName(), throwable.getMessage());
		for (Object param : objects) {
			log.error("异步方法[{}]执行参数: {} ", method.getName(), param);
		}
	}

}
